#:kivy 1.0.7

<EasyLangLearnInputGroup>
    cols: 1

<EasyLangLearnInput>
    size_hint: 1,None
    spacing: 5

    height: 50

    canvas.before:
        Color:
            rgba: 1,1,1,0.7
        Rectangle:
            size: self.width, 1
            pos: self.pos

    Label:
        size_hint: root.label_size, None
        center_y: 25
        height: 50
        text: root.label
        halign: 'right'
        valign: 'middle'
        text_size: self.size
        texture_size: self.size


<EasyLangLearnInputSwitch>
    switch_input: switch_input

    Switch:
        id: switch_input
        size_hint: None, .5
        width: 100
        pos_hint: {'top': 0.75}
        active: root.state


<EasyLangLearnInputDate>
    BoxLayout:
        size_hint: 0.5, 1

        TextInput:
            multiline: False
            size_hint: None, .6
            width: 100
            pos_hint: {'top': 0.8, 'left': 0}
            text: root.text

            on_text_validate: root.on_validate(args[0])
            on_focus: root.on_focus(args[0])

<EasyLangLearnInputText>
    BoxLayout:
        size_hint: 0.5, 1

        TextInput:
            multiline: False
            size_hint: .9, .6
            pos_hint: {'top': 0.8, 'left': 0}
            text: root.text

<EasyLangLearnInputInt>
    BoxLayout:
        size_hint: 0.5, 1

        TextInput:
            multiline: False
            size_hint: None, .6
            width: 100
            pos_hint: {'top': 0.8, 'left': 0}
            text: str(root.number)

            on_text_validate: root.on_validate(args[0])
            on_focus: root.on_focus(args[0])

<EasyLangLearnInputFloat>

<EasyLangLearnInputSelect>
    button: list_button
    BoxLayout:
        size_hint: 0.5, 1

        Button:
            id: list_button
            size_hint: .9, .6
            pos_hint: {'top': 0.8, 'left': 0}
            text: '---'

            on_release: root.open_list()

<EasyLangLearnButton>:
    background_normal: "background.jpg"

<EasyLangLearnImageButton>:
    canvas.before:
        Rectangle:
            source: "background.jpg"
            size: root.size
            pos: root.pos

    Image:
        size_hint: None,None
        source: root.icon
        y: root.y + 5
        x: root.x + 5
        size: root.height-10, root.height-10

    Label:
        text: root.label
        halign: 'center'
        valign: 'middle'


<EasyLangLearnButtonLang>:

<EasyLangLearnScreen>:
    canvas.before:
        Rectangle:
            source: 'background.jpg'

            size: self.size
            pos: self.pos


<EasyLangLearnAccordion>:
    orientation: 'vertical'


<EasyLangLearnAccordionItem>:
    log_data: log

    BoxLayout:
        id: box
        orientation: 'vertical'

        BoxLayout:
            size_hint: 1,None
            height: 50

            orientation: 'horizontal'

            EasyLangLearnButton:
                text: 'Зареди'

                on_press: root.parent.parent.load_from_file(root)

            EasyLangLearnButton:
                text: 'Избери'

                on_press: root.parent.parent.next_page(root)

        Label:
            id: log
            text: 'Няма провеждани изпити'

            valign: 'top'
            halign: 'left'

            markup: True


<EasyLangLearnScreenHome>:


<EasyLangLearnScreenClassifications>:

<EasyLangLearnScreenSetup>:
    test_type: test_type
    from_date: from_date
    to_date: to_date
    words_count: words_count
    guess_count: guess_count

    included_categories: included_categories
    excluded_categories: excluded_categories

    BoxLayout:
        orientation: 'vertical'

        TabbedPanel:
            id: tab

            size_hint: 1,1

            do_default_tab: False

            TabbedPanelItem:
                text: 'Настройки'

                EasyLangLearnInputGroup:
                    EasyLangLearnInputSelect:
                        id: test_type
                        label_size: .5

                        label: 'Тип тест'

                    EasyLangLearnInputDate:
                        id: from_date
                        label_size: .5

                        label: 'Думи въведени от дата'

                    EasyLangLearnInputDate:
                        id: to_date
                        label_size: .5

                        label: 'Думи въведени до дата'

                    EasyLangLearnInputInt:
                        id: words_count
                        label_size: .5

                        label: 'На последните колко думи?'
                        number: 0

                    EasyLangLearnInputInt:
                        id: guess_count
                        label_size: .5

                        label: 'Колко опита да имате?'
                        number: 2


            TabbedPanelItem:
                text: 'Категории (+)'

                BoxLayout:
                    ScrollView:
                        size_hint: 1,1
                        do_scroll_x: False

                        EasyLangLearnInputGroup:
                            id: included_categories

                            size_hint: 1, None
                            height: len(self.children) * 50

            TabbedPanelItem:
                text: 'Категории (-)'

                BoxLayout:
                    ScrollView:
                        size_hint: 1,1
                        do_scroll_x: False

                        EasyLangLearnInputGroup:
                            id: excluded_categories

                            size_hint: 1, None
                            height: len(self.children) * 50



        EasyLangLearnButton:
            text: 'Изпит'

            size_hint: 1,None
            height: 50

            on_press: root.next_page()


<EasyLangLearnScreenExam>:
    word_label: word_label
    word_answer: word_answer
    word_info: word_info

    BoxLayout:
        orientation: 'vertical'

        spacing: 10

        Label:
            id: word_label

            size_hint: 1,None
            height: 50

            text_size: self.size
            halign: 'center'
            valign: 'middle'

            text: ''

        TextInput:
            id: word_answer

            size_hint: 0.5,None
            pos_hint: {'x': 0.25}
            height: 30

            text_size: self.size
            valign: 'middle'
            multiline: False

            text: ''

        Button:
            size_hint: None, None
            pos_hint: {'center_x': 0.5, 'center_y': 0.5}
            width: 100
            height: 30

            text: 'Готово'

            on_press: root.check_word()

        Label:
            id: word_info

            size_hint: 1,1

            text_size: self.size
            halign: 'center'
            valign: 'top'

            markup: True

            text: ''

        EasyLangLearnButton:
            text: 'Край на изпита'

            size_hint: 1,None
            height: 50

            on_press: root.finish_exam()



<EasyLangLearnWindow>:
    EasyLangLearnScreenHome:
        name: "home"

    EasyLangLearnScreenClassifications:
        name: "classification"

    EasyLangLearnScreenSetup:
        name: "setup"

    EasyLangLearnScreenExam:
        name: "exam"



